package com.falcon.controller.toolkit;

import com.falcon.service.IGenMenuComponentService;
import com.falcon.mvc.base.IBaseController;
import com.falcon.mvc.domain.BaseResponse;
import com.falcon.domain.po.MenuComponentPO;
import com.falcon.domain.req.MenuComponentQuery;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/toolkit/menuComponent")
@Tag(name = "5.菜单组件接口", description = "获取菜单组件")
public class GenMenuComponentController implements IBaseController {

    @Autowired
    private IGenMenuComponentService genMenuComponentService;

    @Operation(summary = "待导入表")
    @PostMapping("/candidates")
    public BaseResponse<List<MenuComponentPO>> candidates(@RequestBody MenuComponentQuery query) {

        List<MenuComponentPO> tables= this.genMenuComponentService.queryNewComponents(query);

        return BaseResponse.success(tables);
    }
    @Operation(summary = "批量导入")
    @PostMapping("/imports")
    public BaseResponse<Boolean> imports(@RequestBody List<String> request) {

        this.genMenuComponentService.imports(request);

        return BaseResponse.success(true);
    }

}

